package com.king.juc.syncmode;

import lombok.extern.slf4j.Slf4j;

/**
 * @author king
 * @date 2020/11/5 19:01
 */
@Slf4j(topic = "c.Postman")
public class Postman extends Thread {

    private Integer id;
    private String mail;

    public Postman(Integer id, String mail) {
        this.id = id;
        this.mail = mail;
    }

    @Override
    public void run() {
        GuardedObjectV2 guardedObject = MailBoxes.getGuardedObject(id);
        log.debug("送件后 id: {}, 内容: {}", guardedObject.getId(), mail);
        guardedObject.complete(mail);
    }
}
